Skip to content

fix(deps): promote markdown to a core dependency so rich delivery works out of the box (#32486) - #38649

Merged
benbarclay merged 1 commit into
mainfrom
fix/markdown-core-dep
Jun 4, 2026
Merged

benbarclay merged 1 commit into
mainfrom
fix/markdown-core-dep

Conversation

@benbarclay

Copy link
Copy Markdown

Closes #32486.

Problem

markdown was declared only in the matrix optional extra. The official Docker image installs:

uv sync --frozen --no-install-project --extra all --extra messaging --extra anthropic --extra bedrock --extra azure-identity --extra hindsight

— notably without --extra matrix. The matrix extra is deliberately routed to lazy-install because mautrix[encryption] → python-olm can't build on Windows/macOS (see the 2026-05-12 policy comment in [all]).

So markdown never lands in the image venv, and the Markdown→HTML conversion on the default delivery path silently falls back to plain text. Cron/agent deliveries render raw ## / ** / tables in clients like Element (the Matrix event has no formatted_body). The conversion is now used by both gateway/platforms/matrix.py and tools/send_message_tool.py, so it is no longer matrix-specific — even non-matrix users hit the silent fallback.

Fix

markdown is a pure-Python py3-none-any wheel (~108 KB, no compiled extensions, no platform constraints), so none of the reasons the matrix extra was lazy-routed apply to it. This PR:

  • Promotes Markdown==3.10.2 to a core dependency so it ships in the wheel, the Docker image, and every install.
  • Drops the now-redundant copies from the matrix extra and the platform.matrix lazy-deps group (single source of truth).
  • Refreshes the stale _markdown_to_html docstring that claimed markdown is "installed with the matrix extra".
  • Regenerates uv.lock (markdown moves from marker = "extra == 'matrix'" to an unconditional core dep).

This is the architecturally-consistent variant of the issue's Option 2/3: it removes the silent footgun everywhere without dragging the heavy mautrix/python-olm matrix stack into core.

Verification (real build)

Ran the image's exact uv sync command (same extras, no --extra matrix) in a clean container built off the new lockfile:

import markdown → MARKDOWN OK 3.10.2

On origin/main, the same command leaves markdown absent (it's only in the un-passed matrix extra). Before/after is airtight.

Targeted tests: tests/gateway/test_matrix.py + tests/tools/test_lazy_deps.py → 223 passed, 0 failed.

@benbarclay
benbarclay requested a review from a team June 4, 2026 02:45
@github-actions

github-actions Bot commented Jun 4, 2026 •

Copy link
Copy Markdown

🔎 Lint report: fix/markdown-core-dep vs origin/main

ruff

Total: 0 on HEAD, 0 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 0 pre-existing issues carried over.

ty (type checker)

Total: 9781 on HEAD, 9781 on base (➖ 0)

🆕 New issues: none

✅ Fixed issues: none

Unchanged: 5073 pre-existing issues carried over.

Diagnostics are surfaced as warnings — this check never fails the build.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists dependencies Pull requests that update a dependency file comp/gateway Gateway runner, session dispatch, delivery platform/matrix Matrix adapter (E2EE) labels Jun 4, 2026

ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of PR #38649

Title: fix(deps): promote markdown to a core dependency so rich delivery works out of the box (#32486)

Looks Good

  • Clean diff (18 additions / 9 deletions across 4 files).

Reviewed by Hermes Agent

…ks out of the box (#32486)

`markdown` was declared only in the `matrix` optional extra, and the
official Docker image installs `--extra all --extra messaging --extra
anthropic --extra bedrock --extra azure-identity --extra hindsight` —
notably NOT `--extra matrix` (the matrix extra is deliberately routed to
lazy-install because `mautrix[encryption]`/`python-olm` can't build on
Windows/macOS — see the 2026-05-12 policy comment in `[all]`).

Result: `markdown` never lands in the image venv, so the Markdown->HTML
conversion on the DEFAULT delivery path silently falls back to plain
text. Cron/agent deliveries render raw `##`/`**`/tables in clients like
Element (no `formatted_body`). The conversion is now used by BOTH
`gateway/platforms/matrix.py` and `tools/send_message_tool.py`, so it is
no longer matrix-specific.

`markdown` is a pure-Python `py3-none-any` wheel (~108KB, no compiled
extensions, no platform constraints), so none of the reasons the matrix
extra was lazy-routed apply to it. Promote it to a core dependency so it
ships in the wheel, the Docker image, and every install; drop the now
redundant copies from the `matrix` extra and the `platform.matrix`
lazy-deps group; refresh the stale "installed with the matrix extra"
docstring.

Verified against a real build: ran the image's exact `uv sync` command
(same extras, no `--extra matrix`) in a clean container off the new
lockfile -> `import markdown` succeeds (3.10.2). On `origin/main` the
same command leaves markdown absent. 223 targeted tests pass
(test_matrix.py + test_lazy_deps.py).

Closes #32486.
@benbarclay
benbarclay force-pushed the fix/markdown-core-dep branch from bca33fb to b5a3d6a Compare June 4, 2026 03:20
@benbarclay
benbarclay requested a review from teknium1 June 4, 2026 03:31
@benbarclay
benbarclay enabled auto-merge (squash) June 4, 2026 23:44
@benbarclay
benbarclay merged commit b434f8c into main Jun 4, 2026
@benbarclay
benbarclay deleted the fix/markdown-core-dep branch June 4, 2026 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery dependencies Pull requests that update a dependency file P2 Medium — degraded but workaround exists platform/matrix Matrix adapter (E2EE) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Default Docker image missing markdown dep — cron delivery silently falls back to plain text despite PR #5271

4 participants